<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
$ui = new UI();
if ($curruser['acl'] != 5 || $curruser['acl'] == 5 && $curruser['prev_id'] != 0)
{
    diemsg("你不是大股东！");
}
if ($curruser['acl'] != 255)
{
    $userlist = GetUserList($curruser['id']);
    if ($userlist == "")
    {
        $ui->showErrorPage("<p>还没有建立会员！</p>");
        exit();
    }
}
$conf = new Config();
$tpl = new Template2();
include( "member/news.php" );
$rs = getdb("select id,open from lotto where open>='" . date("Y-m-d") . "' order by open");
if ($rs->eof)
{
    $ui->showErrorPage("<p>目前没有期数！</p>");
    exit();
}
$lotto_id = $rs->f['id'];
$open = $rs->f['open'];
$rs->close();
$tpl->set("lotto_id", $lotto_id);
$tpl->set("open", $open);
$rs = getdb("select * from rate0s where lotto_id=" . $lotto_id . " and user_id=" . $curruser['id']);
if ($rs->eof)
{
    getdb("insert into rate0s (lotto_id, user_id) values (" . $lotto_id . ", " . $curruser['id'] . ")");
}
$rs->close();
$rs = getdb("select * from rate1s where lotto_id=" . $lotto_id . " and user_id=" . $curruser['id']);
if ($rs->eof)
{
    getdb("insert into rate1s (lotto_id, user_id) values (" . $lotto_id . ", " . $curruser['id'] . ")");
}
$rs->close();
$waitbet = $conf->get("waitbet");
$stopbet = $conf->get("stopbet");
$t1 = strtotime($open . " " . $stopbet);
$t2 = strtotime($open . " " . $waitbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$bo1 = isset($_COOKIE['bo1']) ? $_COOKIE['bo1'] : 41;
$bo2 = isset($_COOKIE['bo2']) ? $_COOKIE['bo2'] : 0 - 200000;
$tpl->set("bo1", $bo1);
$tpl->set("bo2", $bo2);
include_once( "class_6h/class.menu.php" );
$fieldArr = array("open" => $open, "lotto_id" => $lotto_id, "split_id" => 1);
$onlineMenu = new menu_6h(11, $fieldArr);
$selectid = getvar("select") == "" ? 0 : getvar("select");
$menuList = $onlineMenu->getMenu($selectid);
$tpl->set("menuList", $menuList);
unset($onlineMenu);
$tpl->load("main", "snow1.htm");
$tpl->set("jslang", $g_conf['language']);
$tpl->show("main");
$ui->footer();
?>